﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Collections;
using ExtBusiness.Admin;

using System.Data;
using ExtBusiness.FlowOperation;

public partial class Xnjc_jxkh_step_assess : PageBase
{
    public string displayType = string.Empty;
    public string wname = string.Empty;
    public string stepName = string.Empty;
    public string timeFromOfAccept = string.Empty;
    public string timeToOfAccept = string.Empty;
    public ArrayList alWorkStatus = null;
    public DataTable dtWorkFlowNames;
    public double secondsPerDay;
    protected string strhtml = string.Empty;

    protected void Page_Load(object sender, EventArgs e)
    {
        displayType = Request["displayType"];
        wname = Request["wname"];
        stepName = Request["stepName"];
        timeFromOfAccept = Request["timeFromOfAccept"];
        timeToOfAccept = Request["timeToOfAccept"];

        ClsWorkFlow clsWorkFlow = new ClsWorkFlow();

        if (!string.IsNullOrEmpty(wname) && !string.IsNullOrEmpty(stepName))
        {
            alWorkStatus = clsWorkFlow.WorkStatusOfStep(wname, stepName, timeFromOfAccept, timeToOfAccept);
        }

        //获取业务名称
        dtWorkFlowNames = clsWorkFlow.GetFlowName();

        secondsPerDay = ExtBusiness.SystemConfig.WorkHoursInEveryDay;


        if (!displayType.Equals("charts"))
        {
            if (alWorkStatus != null)
            {
                foreach (System.Collections.Generic.List<string> m in alWorkStatus)
                {
                    string userid = m[1];
                    string sql = m[4];
                    strhtml += "<tr>  <td>" + m[0] + "</td>  <td> " + m[2] + "  </td> <td>";


                    string totalTimeStr = m[3];

                    long totalTime = 0;
                    if (!string.IsNullOrEmpty(totalTimeStr))
                    {
                        totalTime = Int64.Parse(totalTimeStr);
                    }

                    string cntStr = m[2];
                    int cnt = Int32.Parse(cntStr);
                    if (cnt != 0)
                    {
                        string strResult = ClsWorkDaySet.ToDefaultTime(totalTime / cnt);
                        Response.Write(strResult);
                    }

                    Session["querySql"] = sql;

                    strhtml += "</td><td> <a href='../QueryAndCollect/TaskQueryInstance.aspx'>详细</a></td></tr>";
                }

            }
        }
    }
}
